home *** CD-ROM | disk | FTP | other *** search
- /* stdio.h - standard I/O definitions.
- K & R page 165.
- Entered - G. R. Mansfield. 84/06/05.
- Ver 1.4-4731.
- */
-
- #ifndef _stdio
- #define _stdio
-
- #define BUFSIZE 512
- #define _NFILE 12
-
- typedef struct _iobuf {
- char *_ptr; /* next character position */
- int _cnt; /* number of characters left */
- char *_base; /* location of buffer */
- int _flag; /* mode of file access */
- int _fd; /* file descriptor */
- } FILE;
-
- #ifndef IO2INIT
- extern FILE _iob[_NFILE];
- #endif
-
- #define stdin (&_iob[0])
- #define stdout (&_iob[1])
- #define stderr (&_iob[2])
- #define stdbfr (&_iob[3])
-
- #define _READ 0x01 /* file open for reading */
- #define _WRITE 0x02 /* file open for writing */
- #define _UNBUF 0x04 /* file is unbuffered */
- #define _EOF 0x10 /* EOF has occurred on this file */
- #define _ERR 0x20 /* error has occurred on this file */
- #ifndef NULL
- #define NULL (0)
- #endif
- #define EOF (-1)
- #ifndef ERR
- #define ERR (-1)
- #endif
- #ifndef LERR
- #define LERR (-1L)
- #endif
-
- #define getc(p) (--(p)->_cnt >= 0 \
- ? (*(p)->_ptr++) : _fillbuf(p))
- #define getchar() getc(stdin)
-
- #define putc(c,p) (--(p)->_cnt >= 0 \
- ? ((int)(*(p)->_ptr++ = (c))) : _mtybuf((c),p))
- #define putchar(c) putc(c, stdout)
-
- #define clearerr(fp) ((fp)->_flag & ~_ERR)
- #define feof(fp) ((fp)->_flag & _EOF)
- #define ferror(fp) ((fp)->_flag & _ERR)
- #define fileno(fp) ((fp)->_fd)
-
- #endif
-